package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.PubCenter;
import com.sfzy.mapper.PubCenterMapper;
import com.sfzy.service.PubCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PubCenterServiceImpl
 * @Description TODO
 * @Author niejiacan
 * @Date 2025年08月14日 11:38
 * @Version 1.0
 */
@Service
public class PubCenterServiceImpl implements PubCenterService {
    @Autowired
    private PubCenterMapper pubCenterMapper;


    @Override
    public int addPubCenter(PubCenter pubCenter) {
        return pubCenterMapper.addPubCenter(pubCenter);
    }

    @Override
    public int updatePubCenter(PubCenter pubCenter) {
        return pubCenterMapper.updatePubCenter(pubCenter);
    }

    @Override
    public int deletePubCenter(int id) {
        return pubCenterMapper.deletePubCenter(id);
    }

    @Override
    public PubCenter selectPubCenter(int id) {
        return pubCenterMapper.selectPubCenter(id);
    }

    @Override
    public PageInfo<PubCenter> pageNameContent(PubCenter pubCenter, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<PubCenter> pubCenters = pubCenterMapper.pageNameContent(pubCenter);
        PageInfo<PubCenter> info =  new PageInfo<>(pubCenters);
        return info;
    }
}
